//== SAGITTARIUS ============================================================================

//== BEGINNING OF CODE ===============================================================

#include "sagittarius/core/SagittariusCore.h"
#include "sagittarius/builtins/builtins.h"
#include "sagittarius/session/session.h"
#include "sagittarius/io/io.h"
#include <string.h>
#include <malloc.h>


sg_module* sg_cast_module(sg_value* v) {
    sg_module* mod=(sg_module*)v;
    AT(mod->t == (sg_type*)sg_global_session()->bt->mod, "Invalid cast: not a module");
    return mod;
}

sg_module* sg_create_module(sg_session* s) {
    sg_module* m=malloc(sizeof(sg_module));
    sg_init_val((sg_value*)m);
    m->t = (sg_type*)s->bt->mod;
    m->live = 0;
    return m;
}

void sg_release_module(sg_module* m) {
    free(m);
}
